package jeecg.mongodb.util;

import java.io.File;
import java.io.IOException;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

public class ParseXml {
	public static String parseDBPath() {
		SAXBuilder builder=new SAXBuilder();
		try {
			Document doc=builder.build(new File("src/source/mongoconf.xml"));
			Element root=doc.getRootElement();
			Element dataSpace=root.getChild("dataSpace");
			String path=dataSpace.getAttributeValue("path");
			if(path!=null){
				return path;
			}
		} catch (JDOMException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "null";
	}
	
}
